From 37e0ea3fb98aa7da8fc908f9d97325211bfa3bbb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ball=C3=B3=20Gy=C3=B6rgy?= Date: Mon, 31 Mar 2025 17:12:36 +0200 Subject: [PATCH] runDialog: Fix launching shell command in terminal At one point Clutter became stricter when handling keybindings, and the text's `activate` signal is no longer emitted when additional modifiers are pressed. To fix launching a command in the terminal when activating with ctrl, make the entry non-activatable and move activation to a `key-press-event` handler. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7516 Part-of: --- js/ui/runDialog.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 7e32d74bb..1ce9fe2e2 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -70,6 +70,7 @@ class RunDialog extends ModalDialog.ModalDialog { ShellEntry.addContextMenu(entry); this._entryText = entry.clutter_text; + this._entryText.activatable = false; content.add_child(entry); this.setInitialKeyFocus(this._entryText); @@ -90,14 +91,6 @@ class RunDialog extends ModalDialog.ModalDialog { gsettingsKey: HISTORY_KEY, entry: this._entryText, }); - this._entryText.connect('activate', o => { - this.popModal(); - this._run(o.get_text(), - Clutter.get_current_event().get_state() & Clutter.ModifierType.CONTROL_MASK); - if (!this._commandError || - !this.pushModal()) - this.close(); - }); this._entryText.connect('key-press-event', (o, e) => { let symbol = e.get_key_symbol(); if (symbol === Clutter.KEY_Tab) { @@ -113,6 +106,14 @@ class RunDialog extends ModalDialog.ModalDialog { o.set_cursor_position(text.length + postfix.length); } return Clutter.EVENT_STOP; + } else if ([Clutter.KEY_Return, Clutter.KEY_KP_Enter, Clutter.KEY_ISO_Enter].includes(symbol)) { + this.popModal(); + this._run(o.get_text(), + Clutter.get_current_event().get_state() & Clutter.ModifierType.CONTROL_MASK); + if (!this._commandError || + !this.pushModal()) + this.close(); + return Clutter.EVENT_STOP; } return Clutter.EVENT_PROPAGATE; }); -- 2.39.5